package com.tedu.shoot;

import com.tedu.shoot.img.Images;
import sun.applet.Main;

import java.awt.image.BufferedImage;

/**
 * Date：2021年08月
 * Author：程Sir
 * Content:
 *  英雄类：可以发射子弹
 */
public class Hero extends FlyingObject {
    @Override
    public String toString() {
        return "Hero{" +
                "life=" + life +
                ", fire=" + fire +
                ", wdith=" + wdith +
                ", height=" + height +
                ", x=" + x +
                ", y=" + y +
                '}';
    }

    private int life;
    private int fire;
    public Hero(){
        this.wdith = 130;
        this.height = 108;
        this.x = 150;
        this.y = 450;

        life = 3;
        fire = 4;

    }
    // 表示英雄图片的下标
    int index = 0;
    @Override
    public BufferedImage getImage() {
        BufferedImage[] heros = Images.heroImage;
        // 英雄机两张图的切换，就是他下标的切换
        return heros[index++ % 2];
    }
}
